package model

// License 授权交易状态
type License struct {
	DCI         string `gorm:"type:varchar(90);primarykey;comment:'作品数字指纹'"`
	Seller      string `gorm:"type:varchar(90);not null;comment:'出售方地址'"`
	BlockNumber uint64 `gorm:"not null;comment:'创建授权事件的区块'"`
	BlockTime   uint64 `gorm:"not null;comment:'作品创建的时间'"`
	Price       string `gorm:"not null;comment:'授权价格'"`
	Duration    string `gorm:"not null;comment:'授权使用期限'"`
	Count       uint64 `gorm:"not null;comment:'授权的个数'"`
}

// LicenseRecord 当前授权记录
type LicenseRecord struct {
	TxHash      string `gorm:"primarykey;type:varchar(90);comment:'交易哈希'"`
	RecordID    uint64 `gorm:"not null;comment:'某次授权交易中的记录Id'"`
	DCI         string `gorm:"type:varchar(90);not null;comment:'作品数字指纹'"`
	Seller      string `gorm:"type:varchar(90);not null;comment:'出售方'"`
	Buyer       string `gorm:"type:varchar(90);not null;comment:'购买方'"`
	Price       string `gorm:"not null;comment:'授权价格'"`
	CreatedTime uint64 `gorm:"not null;comment:'授权创建时间'"`
	Deadline    uint64 `gorm:"not null;comment:'授权截止日期'"`
	Type        uint8  `gorm:"not null;comment:'授权的类型'"` // 0多个 1独占
}

// LicenseEvent 授权事件记录
type LicenseEvent struct {
	TxHash      string `gorm:"primarykey;type:varchar(90);comment:'交易哈希'"`
	DCI         string `gorm:"type:varchar(90);index;not null;comment:'作品数字指纹'"`
	From        string `gorm:"type:varchar(90);not null;comment:'事件调用方'"`
	Value       string `gorm:"type:varchar(90);not null;comment:'授权价格'"` // create 授权价格
	EventName   string `gorm:"type:varchar(10);not null;comment:'事件类型'"` // 类型 create:创建 finish:结束拍卖 buy:买方出价
	BlockNumber uint64 `gorm:"not null;comment:'区块高度'"`
	BlockTime   uint64 `gorm:"not null;comment:'区块时间'"`
}
